package shuashuami.hb.com.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import shuashuami.hb.com.hbclient.R;
import shuashuami.hb.com.hdlibrary.glid.GlidUtil;
import shuashuami.hb.com.model.Tixianjilu;

/**
 * Created by Administrator on 2017/6/20.
 */

public class TixianjiluAdatper extends BaseAdapter {
    private LayoutInflater inflater;
    private List<Tixianjilu> list;
    private Context con;

    private GlidUtil glidUtil;

    public TixianjiluAdatper(List<Tixianjilu> list, Context context) {
        this.con = context;
        inflater = LayoutInflater.from(context);
        this.list = list;
        glidUtil = new GlidUtil(context);
    }

    @Override
    public int getCount() {
        if (null != list) {
            return list.size();
        } else {
            return 0;
        }
    }

    public List<Tixianjilu> getList() {
        return list;
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        TaskViewHoler viewHolder;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.adapter_jilu_layout, null);
            viewHolder = new TaskViewHoler();
            viewHolder.tvStatus = (TextView) convertView.findViewById(R.id.tv_adapter_jilu_status);
            viewHolder.tvDate = (TextView) convertView.findViewById(R.id.tv_adapter_jilu_date);
            viewHolder.tvMoney = (TextView) convertView.findViewById(R.id.tv_adapter_jilu_zijin);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (TaskViewHoler) convertView.getTag();
        }
        final Tixianjilu content = list.get(position);
        viewHolder.tvDate.setText(content.getDate());
        viewHolder.tvMoney.setText(content.getMoney());
        viewHolder.tvStatus.setText(content.getStatus());
        return convertView;
    }

    class TaskViewHoler {
        public TextView tvDate, tvMoney, tvStatus;
    }


}





